package com.example.controller;


import com.example.domain.CaptchaCase;
import com.example.service.CaptchaCaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.concurrent.TimeoutException;

@RestController()
@RequestMapping("/code")
public class captchaCaseController {

    @Autowired
    private CaptchaCaseService captchaCaseService;


    @GetMapping
    public String getCode(String tole)  {
        String code = captchaCaseService.sendCode(tole);
        return code;
    }

    @PostMapping
    public Boolean captchaCode(String tole,String code) {
        CaptchaCase captchaCase = new CaptchaCase();
        captchaCase.setCode(code);
        captchaCase.setTele(tole);
        Boolean aBoolean = captchaCaseService.captchaCode(captchaCase);
        return aBoolean;
    }
}
